package com.backend.aptimgview.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.backend.aptimgview.mapper.AptimgViewMapper;
import com.backend.aptimgview.domain.AptimgView;
import com.backend.aptimgview.service.IAptimgViewService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 公寓图片管理Service业务层处理
 *
 * @author fusi
 * @date 2024-10-06
 */
@Service
public class AptimgViewServiceImpl implements IAptimgViewService {
    @Autowired
    private AptimgViewMapper aptimgViewMapper;

    @Override
    public AptimgView selectAptimgViewByImageApartmentId(Long imageApartmentId) {
        return aptimgViewMapper.selectAptimgViewByImageApartmentId(imageApartmentId);
    }

    public AptimgView selectAptimgViewByApartmentId(Long apartmentId) {
        return aptimgViewMapper.selectAptimgViewByApartmentId(apartmentId);
    }

    @Override
    public List<AptimgView> selectAptimgViewList(AptimgView aptimgView) {
        return aptimgViewMapper.selectAptimgViewList(aptimgView);
    }

    @Transactional
    @Override
    public int insertAptimgView(AptimgView aptimgView) {
        int a = aptimgViewMapper.insertImageApartment(aptimgView);
        return a>0 ?a:0;
    }

    @Transactional
    @Override
    public int updateAptimgView(AptimgView aptimgView) {
        int a = aptimgViewMapper.updateImageApartment(aptimgView);
        return a>0?a:0;
    }

    @Override
    public int deleteAptimgViews(Long[] imageApartmentIds) {
        return aptimgViewMapper.deleteAptimgViewByImageApartmentIds(imageApartmentIds);
    }

}
